﻿using System;
using System.Collections.Generic;
using System.Windows.Browser;

namespace SilverQuery
{
	/// <summary>
	/// Type used to invoke a jQuery function that expects a set of key/value pairs.
	/// </summary>
	public class map : Dictionary<string, object>
	{
		internal ScriptObject ToScriptObject()
		{
			var map = (ScriptObject)SilverQueryBridge.InvokeScriptFunction("createEmptyMap");
			foreach (string key in this.Keys)
			{
				map.SetProperty(key, this[key]);
			}
			return map;
		}
	}
}
